package com.bjpowernode.util;

import com.bjpowernode.entity.TUser;
import org.springframework.security.core.Authentication;
import org.springframework.security.core.context.SecurityContextHolder;

public class LoginInfoUtil {
    /**
     * 获取当前登录用户的信息
     * @return
     */
    public static TUser getCurrentLoginUser(){
        Authentication authentication =
                SecurityContextHolder.getContext().getAuthentication();
        TUser user = (TUser)authentication.getPrincipal();
        return user;
    }
}
